* {
    margin: 0;
    padding: 0;
}

body {
    width: 100vm;
    background: #f2f2f2;
}

li {
    list-style: none;
}

a {
    text-decoration: none;
    color: #000000;
}

.navbar {
    width: 100%;
    height: 70px;
    background: #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, .3);
}

.navbar .nav {
    width: 1200px;
    height: 100%;
    margin: 0 auto;
}

.navbar .nav ul {
    position: relative;
    display: flex;
    justify-content: space-around;
    width: 100%;
    height: 100%;
}

.navbar .nav ul>li {
    width: 100%;
    height: 100%;
}

.navbar .nav ul>li>a {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 70px;
    text-align: center;
}

.navbar .nav ul>li>ol {
    width: 100%;
    background: #fff;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, .2);
    transform: scaleY(0);
    transition: all 0.6s;
    transform-origin: 50% 0;
}

.navbar .nav ul>li>ol>li {
    height: 70px;
    border-bottom: 1px solid rgb(245, 245, 245);
}

.navbar .nav ul>li>ol>li>a {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 70px;
    text-align: center;
}

.navbar .nav ul>li>ol>li:hover {
    background: rgba(0, 0, 0, 0.03);
}

.navbar .nav ul li:hover ol {
    transform: scaleY(1);
}

/* 设置线条 */
.navbar .nav ul .underline {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 240px;
    height: 6px;
    background: red;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    transition: all 0.5s;
    pointer-events: none;
}

/* 边框三角的实现方法一 */
.navbar .nav ul .underline::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 10px;
    top: -10px;
    left: calc(50% - 9px);
    background: inherit;
    clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

/* 边框三角的实现方法二*/
/* .navbar .nav ul .underline::before{
    content: "";
    position: absolute;
    display: block;
    top: -20px;
    left: calc(50% - 9px);
    border: 10px solid transparent;
    border-bottom-color: red;
} */
.navbar .nav ul>li:nth-child(2):hover~.underline {
    left: 240px;
}

.navbar .nav ul>li:nth-child(3):hover~.underline {
    left: 480px;
}

.navbar .nav ul>li:nth-child(4):hover~.underline {
    left: 720px;
}

.navbar .nav ul>li:nth-child(5):hover~.underline {
    left: 960px;
}